﻿@model IEnumerable<Common.Views.ShoppingCartView>

@{
    ViewBag.Title = "MyCart";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>My Cart</h2>

<script type="text/javascript">
    $(function() {
        $('#DeleteButton').click(function () {
             return window.confirm("You are about to delete all item(s) in your cart. Continue?")
        });
    });
</script>
<script type="text/javascript">
    function confirmDelete() {
        return window.confirm("Are you sure you want to delete?");
    }
</script>
<table>
    <tr>

        <th>
            ProductName
        </th>
        <th>
            Quantity
        </th>
        <th>
            Price
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        
            @Html.HiddenFor(modelItem => item.ProductID)        
        <td>
            @Html.DisplayFor(modelItem => item.ProductName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Quantity)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Price)
        </td>
        
    </tr>     
}
</table>

<br/>

@Html.ActionLink("Purchase All Items", "Purchase") | @Html.ActionLink("Delete Item(s) in cart", "Delete", new { onclick = "return confirmDelete();" })